﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Truextend.Training.Presenter.ViewInterfaces;
using Truextend.Training.Model.Entities;
using Truextend.Training.Business;
using Truextend.Training.Business.Dtos;
using Truextend.Training.Service;

namespace Truextend.Training.Presenter
{
    public class ListCourseInstanceManagePresenter
    {
        private IListCourseInstanceManageView view;

        public ListCourseInstanceManagePresenter(IListCourseInstanceManageView view)
        {
            if (view == null)
            {
                throw new ArgumentNullException("View may not be null");
            }
            this.view = view;
        }

        public void InitView()
        {
            try
            {
                view.Message = "Available course instances";
                //List<CourseInstance> courseVersionsList = CourseInstanceControl.GetAllCoursesAvailable();
                IList<CourseInstanceInstructorDto> courseVersionsList = new CourseInstanceService().GetAllCourseInstancesAvailables();
                view.CourseInstanceInstructorDtos = courseVersionsList;
            }
            catch (Exception e)
            {
                view.Message = e.Message;
            }

        }

    }
}
